﻿@{
    ViewBag.Title = "Details"; 
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    layui.use(['jquery', 'form', 'laydate', 'common', 'table', 'upload'], function () {
        var form = layui.form,
            $ = layui.$,
            common = layui.common,
        table = layui.table,
            upload = layui.upload;
        var keyValue = $.request("keyValue");
        //权限字段
        common.authorizeFields('adminform');

        var CpkTableData;
        var tableIns;
        var tableId = "CpkTableId";
        var tableFilter = "CpkTableFilter";

        $(function () {
            initControl();
            common.ajax({
                url: '/MaterialManage/Material/GetFormJson',
                dataType: 'json',
                data: { keyValue: keyValue },
                async: false,
                success: function (data) {
                    common.val('adminform', data);
                    common.setReadOnly('adminform');
                    MaterialTypeChange(data.F_MaterialType);

                    CpkTableData = JSON.parse(data.F_CpkStData);
                }
            });
            form.render();

            tableIns = table.render({
                elem: '#' + tableId
                , data: CpkTableData
                , cols: [[
                    { title: '序号', type: 'numbers', width: 40 }
                    , { field: 'field_name', title: '分析字段', width: 120}
                    , { field: 'st', title: '标准值', width: 120}
                    , { field: 'st_tu', title: '上偏差', width: 120}
                    , { field: 'st_tl', title: '下偏差', width: 120}
                    , { field: 'st_pic', title: '图像', minWidth: 80, }
                    //, { title: '操作', width: 210, toolbar: '#CpkTableBar', align: "left" }

                ]]
                , page: false
                , done: function (res, curr, count) {
               

                }
            });

        });
        wcLoading.close();

        function initControl() {
            $("#F_MaterialType").bindSelect({
                data: top.clients.dataItems['Mes_MaterialType'],
                id: "",
            });
        }
        //监听复选框
        form.on('select(MaterialType)', function (data) {
            MaterialTypeChange(data.value);
            form.render();
        });
        function MaterialTypeChange(value) {
            if (value == "0") {
                $('#F_Customer').parent().parent().removeClass('layui-hide');
                $('#F_CustomerProNO').parent().parent().removeClass('layui-hide');
            }
            else {
                $('#F_Customer').parent().parent().addClass('layui-hide');
                $('#F_CustomerProNO').parent().parent().addClass('layui-hide');
                $('#F_Customer').val("");
                $('#F_CustomerProNO').val("");
            }
        }
   });
</script>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <div class="layui-form layuimini-form" lay-filter="adminform">
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">物料分类</label>
                    <div class="layui-input-block">
                        <select id="F_MaterialType" name="F_MaterialType" lay-search>
                            <option value="" selected>请选择</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">物料编号</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_MaterialCode" name="F_MaterialCode" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">物料名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_MaterialName" name="F_MaterialName" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">容器值</label>
                    <div class="layui-input-block">
                        <input type="number" pattern="[0-9]*" id="F_ContainerNum" name="F_ContainerNum" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">领用倍数限制</label>
                    <div class="layui-input-block">
                        <input type="number" pattern="[0-9]*" id="F_ReceiveNum" name="F_ReceiveNum" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">物料描述</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_MaterialDescription" name="F_MaterialDescription" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">物料单位</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_MaterialUnit" name="F_MaterialUnit" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">物料规格</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_MaterialSize" name="F_MaterialSize" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">物料材质</label>
                    <div class="layui-input-block">
                        <div class="layui-input-block">
                            <input type="text" id="F_MaterialBy" name="F_MaterialBy" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">客户名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_Customer" name="F_Customer" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">客户品号</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_CustomerProNO" name="F_CustomerProNO" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">扫描Cpk标准值表</label>
                    <div style="padding:4px;border:1px solid #E0E0E0" class="layui-input-block">
                        <table class="layui-hide layui-table-cell" id="CpkTableId" lay-filter="CpkTableFilter"></table>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">选项</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
                        <input type="checkbox" name="F_NeedCheckout" id="F_NeedCheckout" value="true" title="需要检验">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text layui-hide">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea id="F_Description" name="F_Description" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</body>

